﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Example07.aspx.cs" Inherits="Chapter36.Example07" %>

<!DOCTYPE html>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>代码清单 36-7 使用 arc 方法</title>
    <meta name="author" content="Adam Freeman" />
    <meta name="description" content="A simple example" />
    <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
    <style>
        canvas {
            border: thin solid black;
        }

        body > * {
            float: left;
        }
    </style>
</head>
<body>
    <canvas id="canvas" width="500" height="140">Your browser doesn't support the <code>canvas</code> element.</canvas>
    <script>
        var ctx = document.getElementById('canvas').getContext('2d');
        ctx.fillStyle = 'yellow';
        ctx.lineWidth = 3;

        ctx.beginPath();
        ctx.arc(70, 70, 60, 0, Math.PI * 2, true);
        ctx.stroke();

        ctx.beginPath();
        ctx.arc(200, 70, 60, Math.PI / 2, Math.PI, true);
        ctx.fill();
        ctx.stroke();

        ctx.beginPath();
        var value = 0;
        for (var i = 0; i < 4; i++) {
            ctx.arc(350, 70, 60, value, value + Math.PI / 4, false);
            value += Math.PI / 2;
        }
        ctx.closePath();
        ctx.fill();
        ctx.stroke();
    </script>
</body>
</html>
